<style>
    table.adminlist tbody tr td { padding: 8px 8px; }
    table.adminlist thead th { padding: 8px; }
</style>
<?php
defined('_JEXEC') or die('Restricted access');
$complainType = JHTMLwrd::listComplainTypeRaw();
$mealPeriod = JHTMLwrd::listMealPeriodRaw();
?>
<div class="row-fluid">
	<div class="alert">
		<table>
			 <tr>
			 	<td colspan="4" style="text-align: right ;">
			 		<?php if($this->user->authorise('wrd.profile.memberservices.add', 'com_wrd')): ?>
			 		<a href="index.php?option=com_wrd&controller=mservices&task=add<?php if(!empty($this->data->member_id)){ echo '&vip_num='.$this->data->member_id ; } ?>">
						<img title="Add New" style="float: right ;" src="<?php echo JURI::base() .'/components/com_wrd/assets/images/add_new.png'?>">
			 		</a>
			 		<?php endif; ?>
			 	</td>
			 </tr>
	 	</table>
 	</div>
	<table class="adminlist extra-adminlist table table-striped">
        <thead>
		     <tr>
		 	    <th nowrap="nowrap">Member ID</th>        
                <th nowrap="nowrap">Name</th> 
				<th width="200" nowrap="nowrap">Member Type</th> 
                <th nowrap="nowrap">Created Date</th>            
                <th nowrap="nowrap">Question</th>
                <th nowrap="nowrap">Answer</th>
                <th nowrap="nowrap">Meal period</th>        
                <th nowrap="nowrap">Outlet</th>  
                <th nowrap="nowrap">Last Transaction</th> 
                <th nowrap="nowrap">Pick up Date</th> 
                <th nowrap="nowrap">Visit Date</th> 
                <th nowrap="nowrap">Handle By</th>      
		     </tr>
         </thead>
         <tbody>
		 <?php if(count($this->mservices) > 0):  //echo "<pre>"; print_r($this->mservices);?>
			 <?php foreach ($this->mservices as $mservices): ?>
			 	<tr>
			 		<td style="text-align: center;"><?php echo $mservices->vip_number ; ?></td>
					<td>
                        <a href="index.php?option=com_wrd&controller=mservices&id=<?php echo $mservices->id; ?>&layout=form">
                            <?php echo $mservices->l_name.' '.$mservices->f_name ; ?>
                        </a>
                    </td>
					<td><?php $arr = explode('_',$mservices->member_type);if($arr[0]) echo "Top Spenders (".$mservices->top_spender_date.")<br />";if($arr[1]) echo "New Join Members (".$mservices->new_join_member_date.")<br />"; if($arr[2]) echo "Inactive Members (".$mservices->inactive_member_date.")<br />"; if($arr[3]) echo "Daily Top Spenders (".$mservices->daily_top_date.")<br />"; ?></td>
			 		<td style="text-align: center;"><?php echo $mservices->created_date ; ?></td>
			 		<td><?php echo $mservices->questions ; ?></td>
                    <td><?php echo $mservices->answer ; ?></td>
                    
                    <td><?php echo $mealPeriod[$mservices->meal_period] ; ?></td>
                    <td><?php echo $mservices->outlet_name ; ?></td>
					<td><?php echo $mservices->transaction ; ?></td>
					<td><?php echo $mservices->pick_up_date ; ?></td>
					<td style="text-align: center;"><?php echo $mservices->visit_date ; ?></td>
	                
                    <td><?php echo $mservices->handle_name ; ?></td>	
			 	</tr>
			 <?php endforeach; ?>
		 <?php endif; ?>
         </tbody>
	 </table>
</div>